<script type="text/javascript">
	$(function() {
	    $.fn.dataGridOptions.formSubFun("#form",'/modules/additional/newActivityRule/newActivityRuleAdd.html',"添加成功！","添加失败！");
	});
	$("#type").change(function(){
		$('#ruleId option:gt(0)').remove();
		$.post("/modules/additional/newActivityRule/initRuleNameSelect.html",
			{
				ruleType : $(this).val()
			},
			function(result,status){
				if(result != null && status == "success") {
					var data = eval(result);
					$.each(data, function (index, item) {
						$("#ruleId").append($('<option value="' + item.rule_id + '">' + item.rule_name + '</option>'));//后台数据加到下拉框
					});
				}
			})
	});

	$(function(){
		$.ajax({
			type: "post",
			contentType: "application/json",
			url: "/modules/additional/newActivityRule/initActivitySelect.html",
			data: "{}",
			success: function (result) {
				var data = eval(result);
				$.each(data, function(index, item){
					$("#activityId").append($('<option value="'+item.activity_id+'">'+item.activity_name+'</option>'));//后台数据加到下拉框
				});
			}
		});
	});

</script>
<style>
.hide{display:none;}
.sForm .ipt{margin-left:155px;}
.sForm .ipt1{margin-bottom:20px;margin-left:155px;}
.sForm .lab{width:139px;}
</style>
<div class="popForm sForm">
    <form id="form"  method="post">
		<div class="formitm">
			<label class="lab">活动名称：</label>
			<div class="ipt">
				<select name="activityId" id="activityId">
					<option>--请选择--</option>
				</select>
				<b>*</b>
			</div>
		</div>
		<div class="formitm">
			<label class="lab">规则类型：</label>
			<div class="ipt">
				<select name="type" id="type">
					<option>--请选择--</option>
					<option value="1">红包</option>
					<option value="2">体验券</option>
					<option value="3">加息券</option>
					<option value="4">抽奖</option>
					<option value="5">电影票</option>
					<option value="7">酒券</option>
					<option value="6">现金</option>
				</select>
				<b>*</b>
			</div>
		</div>

		<div class="formitm">
			<label class="lab">规则名称：</label>
			<div class="ipt">
				<select name="ruleId" id="ruleId">
					<option>--请选择--</option>
				</select>
				<b>*</b>
			</div>
		</div>

		<div class="formitm">
		     <label class="lab">是否启用：</label>
		     <div class="ipt">
		     	<input type="radio" id="status" class="xj-hongbao" value="0" name="status" checked="checked">启用
		     	<input type="radio" id="status" class="xn-hongbao" value="1" name="status">不启用
		     </div>
		</div>

		<div class="formitm">
			<label class="lab">活动规则开始时间：</label>
			<div class="ipt">
				<input type="text" name="startTime" id="startTime" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'endTime\')}',dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true})" class="searchTime"/>
				<b>*</b>
			</div>
		</div>
		<div class="formitm">
			<label class="lab">活动规则结束时间：</label>
			<div class="ipt">
				<input type="text" name="endTime" id="endTime" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'startTime\')}',dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true})" class="searchTime"/>
				<b>*</b>
			</div>
		</div>
		<div class="formitm">
			 <label class="lab">活动规则描述：</label>
			 <div class="ipt">
				<textarea rows="3" maxlength="250" cols="50" name="description"></textarea>
			 </div>
		</div>
	</form>
</div>